package com.zmx.patients.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.patients.R;
import com.zmx.patients.pojo.MyRecipe;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 程序猿：胖胖祥
 * 时 间：2021/2/28  21:26
 * 功 能：
 */

public class MyRecipeAdapter extends BaseAdapterRvList<MyRecipeAdapter.ViewHolder, MyRecipe> {

    public MyRecipeAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, MyRecipe myRecipe) {

        holder.text1.setText("接诊医生："+myRecipe.getDoctor_name());
        holder.text2.setText("药方种类："+myRecipe.getCount());
        if (myRecipe.getTypes() == 0){

            holder.text3.setText("诊断方式：个人问诊");

        }else if (myRecipe.getTypes() == 1){

            holder.text3.setText("诊断方式：团队问诊");

        }else{

            holder.text3.setText("诊断方式：在线挂号");

        }
        holder.text4.setText("开方时间："+myRecipe.getAddtime());

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {

        MyRecipeAdapter.ViewHolder holder = new MyRecipeAdapter.ViewHolder(inflater.inflate(R.layout.adapter_my_recipe, parent, false));
        return holder;

    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.text1)
        TextView text1;
        @BindView(R.id.text2)
        TextView text2;
        @BindView(R.id.text3)
        TextView text3;
        @BindView(R.id.text4)
        TextView text4;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }

}

